#include<iostream>
using namespace std;
#define OK 0
#define ERROR 0
typedef struct{
	int data[1001];
	int front;
	int rear;
}Queue; 
typedef Queue *Squeue;
Squeue AQueue,BQueue;
int EnQueue(Squeue &Q,int e);
int QueueEmpty(Squeue &Q);
int DeQueue(Squeue &Q,int &e);
int InitQueue(Squeue &Q);
int main()
{
	int n,num,e,i,k=0;
	cin>>n;
	InitQueue(AQueue);
	InitQueue(BQueue);
	for(i=1;i<=n;i++)
	{
		cin>>num;
		if(num%2==0)
		EnQueue(BQueue,num);
		else
		EnQueue(AQueue,num);
	}
    while(!QueueEmpty(AQueue)&&!QueueEmpty(BQueue)) 
    {
    	DeQueue(AQueue,e);
    	if(k==0)
    	{cout<<e;
		k++;}
    	else
		cout<<" "<<e;
	    if(!QueueEmpty(AQueue))
    	DeQueue(AQueue,e);
 		cout<<" "<<e;   	
		DeQueue(BQueue,e);
		if(k==0)
    	{cout<<e;
		k++;}
    	else
		cout<<" "<<e;
	}
	while(!QueueEmpty(AQueue))
	{
	    DeQueue(AQueue,e);
		if(k==0)
    	{cout<<e;
		k++;}
    	else
		cout<<" "<<e;	
	}
	while(!QueueEmpty(BQueue))
	{
		DeQueue(BQueue,e);
		if(k==0)
    	{cout<<e;
		k++;}
    	else
		cout<<" "<<e;
	}
	return 0;
  } 
 int InitQueue(Squeue &Q)
 {
 	Q=new Queue;
 	Q->front=Q->rear=0;
 	return OK;
  } 
int EnQueue(Squeue &Q,int e)
{
	if(Q->rear==1000)
	return false;
	Q->data[Q->rear]=e;
	Q->rear++;
	return true;
}  
int DeQueue(Squeue &Q,int &e)
{
	if(Q->front==Q->rear)
	return ERROR;
	e=Q->data[Q->front];
	Q->front++;
	return true;
}
int QueueEmpty(Squeue &Q)
{
	return (Q->front==Q->rear);
}
